#!/bin/bash

if [ ! $1 ]; then
	echo "ERROR! Need input file!"
	exit 1
fi

sed "s/\({[^{}]*{[^{}]*}[^{}]*},\)/\1\n/g" $1 | \
sed "s/\(detail':{\)/\1\n/g" | \
sed "s/}}},/}}},\n\n/g"

